[PATCH 12/24] libfdisk: (gpt) don't ignore fsync() errors
authorKarel Zak <kzak@redhat.com>
Thu, 11 Aug 2022 11:09:05 +0000 (13:09 +0200)
committerChris Hofstaedtler <zeha@debian.org>
Fri, 25 Nov 2022 15:19:08 +0000 (15:19 +0000)
Signed-off-by: Karel Zak <kzak@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name 0012-libfdisk-gpt-don-t-ignore-fsync-errors.patch

libfdisk/src/gpt.c

index 72370a19a7b8093bf654724000d59bda3f5efb11..8a91d7a31f3eb9796e8889dcfa891d2e09a468db 100644 (file)
@@ -2032,7 +2032,8 @@ static int gpt_write(struct fdisk_context *cxt, off_t offset, void *buf, size_t
        if (write_all(cxt->dev_fd, buf, count))
                return -errno;
 
-       fsync(cxt->dev_fd);
+       if (fsync(cxt->dev_fd) != 0)
+               return -errno;
 
        DBG(GPT, ul_debug("  write OK [offset=%zu, size=%zu]",
                                (size_t) offset, count));